home *** CD-ROM | disk | FTP | other *** search
/ MacTech 1 to 12 / MacTech-vol-1-12.toast / Source / MacTech® Magazine / Volume 07 - 1991 / 07.06 Jun 91 / Split Button Code / Split Button Stack / stack_-1.xml < prev    next >
Encoding:
Extensible Markup Language  |  1990-08-04  |  4.0 KB  |  16 lines

  1. <?xml version="1.0" encoding="utf-8" ?>
  2. <!DOCTYPE stack PUBLIC "-//Apple, Inc.//DTD stack V 2.0//EN" "" >
  3. <stack>
  4.     <name>in</name>
  5.     <id>-1</id>
  6.     <cardCount>1</cardCount>
  7.     <cardID>3851</cardID>
  8.     <listID>3359</listID>
  9.     <cantModify><false /></cantModify>
  10.     <cantDelete><false /></cantDelete>
  11.     <cantAbort><false /></cantAbort>
  12.     <cardSize>
  13.         <width>512</width>
  14.         <height>342</height>
  15.     </cardSize>
  16.     <script>
  17. --Copyright ¬© 1990 MacTutor
  18.  
  19. --Written by Carl J. Manaster
  20. --August, 1990
  21.  
  22. --message split
  23. --syntax: split(orientation,topMessage,bottomMessage)
  24. ----------where: orientation is "/" or "\"
  25. ----------topMessage is message to be called if click
  26. --------------------------was in top half of target
  27. ----------bottomMessage is message to be called if click
  28. --------------------------was in bottom half of target
  29.  
  30. on split
  31. put param(2) into topMessage
  32. put param(3) into bottomMessage
  33. put (the bottom of the target) - (the clickV) into vDiff
  34. if param(1) is "/"
  35. then put (the clickH) - (the left of the target) into hDiff
  36. else put (the right of the target) - (the clickH) into hDiff
  37. put vDiff*(the width of the target)>hDiff*(the height of the target) into doTop
  38.  
  39. if doTop
  40. then send topMessage to target
  41. else send bottomMessage to target
  42.  
  43. end split
  44. ---------------------------------------------------------------------
  45.  
  46.  
  47. --message makePolyButton
  48. --syntax: makePolyButton(inMessage,outMessage)
  49. ----------inMessage is message to be called by clicks
  50. --------------------------within the polyButton
  51. ----------outMessage is message to be called by clicks
  52. --------------------------outside the polyButton
  53.  
  54. on makePolyButton inMessage,outMessage
  55. put empty into pointList
  56. choose line tool
  57. set the cursor to cross
  58. wait until the mouseClick
  59. put the clickLoc into pointList
  60.  
  61. repeat
  62. wait until the mouseClick
  63. put return & the clickLoc after pointList
  64. put the number of lines of pointList into count
  65. drag from (line count-1 of pointList) to (line count of pointList)
  66. if abs(item 1 of last line of pointList - item 1 of first line of pointList)<2¬¨
  67. and abs(item 2 of last line of pointList - item 2 of first line of pointList)<2 then exit repeat
  68. end repeat
  69.  
  70. put line 1 of pointList into last line of pointList
  71. put the number of card buttons into cbCount
  72. set lockScreen to true
  73. doMenu revert
  74. choose button tool
  75.  
  76. put item 1 of line 1 of pointList into maxV
  77. put item 1 of line 2 of pointList into maxPenV
  78. put item 1 of line 1 of pointList into minV
  79. put item 1 of line 2 of pointList into minPenV
  80.  
  81. put item 2 of line 1 of pointList into maxH
  82. put item 2 of line 2 of pointList into maxPenH
  83. put item 2 of line 1 of pointList into minH
  84. put item 2 of line 2 of pointList into minPenH
  85.  
  86. repeat with i=2 to count
  87.  
  88. get item 1 of line i of pointList
  89. if it > maxPenV then                --find the largest
  90. if it > maxV then                 --and second largest v
  91. put maxV into maxPenV
  92. put it into maxV
  93. else
  94. put it into maxPenV
  95. end if
  96. end if
  97.  
  98. if it < minPenV then                --find the smallest
  99. if it < minV then                 --and second smallest v
  100. put minV into minPenV
  101. put it into minV
  102. else
  103. put it into minPenV
  104. end if
  105. end if
  106.  
  107. get item 2 of line i of pointList
  108. if it > maxPenH then                --find the largest
  109. if it > maxH then                 --and second largest h
  110. put maxH into maxPenH
  111. put it into maxH
  112. else
  113. put it into maxPenH
  114. end if
  115. end if
  116.  
  117. if it < minPenH then                --find the smallest
  118. if it < minH then                 --and second smallest h
  119. put minH into minPenH
  120. put it into minH
  121. else
  122. put it into minPenH
  123. end if
  124. end if
  125.  
  126. end repeat
  127.  
  128. add 1 to cbCount       --create the interior button
  129. doMenu "new button"
  130. set the style of card button cbCount to transparent
  131. set the showName of card button cbCount to false
  132. set the autoHilite of card button cbCount to false
  133. set the rect of card button cbCount to minPenV,minPenH,maxPenV,maxPenH
  134. put "on mouseUp" into theScript
  135. put return & inMessage after theScript
  136. put return & "end mouseUp" after theScript
  137. set the script of card button cbCount to theScript
  138.  
  139. repeat with i=1 to count-1
  140. add 1 to cbCount     --create the